package com.sky.mapper;

import com.sky.entity.AddressBook;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author rdxcf
* @description 针对表【address_book(地址簿)】的数据库操作Mapper
* @createDate 2024-09-06 20:35:12
* @Entity mappers.domain.AddressBook
*/
@Mapper
public interface AddressBookMapper{

    List<AddressBook> list(AddressBook addressBook);

    void insert(AddressBook addressBook);

    @Select("select * from address_book where id=#{id}")
    AddressBook getById(Long id);

    void update(AddressBook addressBook);

    @Select("update address_book set is_default=#{isDefault} where user_id=#{userId}")
    void updateIsDefaultByUserId(AddressBook addressBook);

    @Delete("delete from address_book where id=#{id}")
    void deleteById(Long id);
}




